Naming Rules and Conventions

Rules
1. Names may have letters, numbers, an underscore ( _ ), or dollar sign ( $ ).
2. They cannot begin with a number and must not have a space.

EXAMPLE: 1manga (incorrect)

3. Names must start with a letter, $, or underscore.

EXAMPLE: _flapJacks , $flapJacks , flapJacks (correct)

4. They must not have spaces or any other characters not mentioned above.
5. Java keywords must not be used when naming.
6. The names should have clarity and elegance.
Note: Java keywords include, but are not limited to, int, double, boolean, String, true, false, new, and private.
Conventions
1. Make names meaningful and descriptive.
2. A common convention is to capitalize the letter of a new word in an identifier.
Example: computerScience ; meermansLovesNaruto ; laugh ;
(this is known as camel hump notation)
3. Class names should begin in with a capital letter and any other words in the name should also be capitalized.
4. Object Names generally begin with a lowercase letter.
5. Method names begin with lowercase letter. All other words in it begin with a capitalized letter.
Example: onMouseClick instead of OnMouseClick
6. Method names should be verbs and always have parentheses at the end. For ex. nextInt()
7. Final variable names should be in ALL CAPS and be separated by underscores.

Naming Cont...
Variable Naming
Class Name
-singular name(no s in the end)
-name it with capital FIRST LETTER also capital SECOND word
-example
good - Bug; BoxBug
bad - Bugs; bug

Instant Variables
(int, double, straing, FilledRect, etc)nouns
DO NOT capitalize 1st word
DO capitalize every new word in it
ex.
good - bob; sueAnne
bad - Bob; sueanne

Method Names
Same as instant variables except:
-Always have paranthesis()
-They shoud be verbs

Constant/Finals
Finals are entirely in capitals
ex.
-MAX_HEIGHT
put underscore for new words